package com.etrans.web.gps.business.gis.service;

import java.util.HashMap;
import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.etrans.web.gps.base.service.BaseService;
import com.etrans.web.gps.business.gis.domain.CustomMap;

@Service
public class CustomMapService  extends BaseService{


	/**
	 * @param contactperson
	 */
	@Transactional(readOnly = false, rollbackFor = { DataAccessException.class,
			Exception.class })
	public void saveCustomMap(CustomMap CustomMap) {
		this.insert("customMapMapper.saveCustomMap", CustomMap);
	}
	
	/**
	 * 批量插入
	 * @param contactperson
	 */
	@Transactional(readOnly = false, rollbackFor = { DataAccessException.class,
			Exception.class })
	public void insertCustomMap(List<CustomMap> customMapList) {
		this.insert("customMapMapper.insertCustomMap", customMapList);

	}
	
	/**
	 * @param contactperson
	 */
	@Transactional(readOnly = false, rollbackFor = { DataAccessException.class,
			Exception.class })
	public void updateCustomMap(CustomMap CustomMap) {
		this.update("customMapMapper.updateCustomMap", CustomMap);
	}
	
	/**
	 * @param id
	 */
	@Transactional(readOnly = false, rollbackFor = { DataAccessException.class,Exception.class })
	public void deleteCustomMapByID(Integer id) {
		this.delete("customMapMapper.deleteCustomMapByID", id);
	}
	
	/**
	 * @param id
	 * @return
	 */
	public CustomMap queryCustomMapById(Integer id) {
		CustomMap CustomMap = (CustomMap) this.selectOne("customMapQuery.queryCustomMapById", id);
		return CustomMap;
	}
	
	
	/**
	 * 判断重复
	 * 
	 * @param param  
	 * @return
	 */
	public boolean queryisReCustomMap(HashMap<String, Object> param) {
		boolean result=false;
		List<HashMap<String, Object>> list =	this.selectList("customMapQuery.queryisReCustomMap", param);
		if(null!=list&&list.size()>0){
			result=true;
		}
		return result ; 
	} 
	

	
	/*
    public String GetOriginLonLatList(String lonLat)
    {
    	String[] lonlatArray=lonLat.split(",");
    	GaoDePoint originlonlatArray;
    	String originLonLatString="";
    	for (String perlonlat : lonlatArray) {
    	
    		originlonlatArray=GaoDeConverter.getInstance().getEncryPoint(Double.parseDouble(perlonlat.split("\\|")[0]), Double.parseDouble(perlonlat.split("\\|")[1]));
    		
    		originLonLatString=originLonLatString+String.format(",%s|%s", originlonlatArray.x,originlonlatArray.y);
		}
    	if(originLonLatString.length()>0)
    	{
    		originLonLatString=originLonLatString.substring(1);
    	}
    	return originLonLatString;
    }*/
	
	public List<CustomMap> queryAllCustomMap(HashMap<String, Object> param) {
		return  this.selectList("customMapQuery.queryAllCustomMap", param);
	}

	public long queryCustomMapCount(HashMap<String, Object> param) {
		return (Long) this.selectOne("customMapQuery.queryCustomMapCount", param);
	}
	
	
	
}
